package com.vcens.dingnotice.repository;

import com.vcens.dingnotice.entity.MessageEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MessageMapper {

    @Insert("INSERT INTO message_infos(task_id,type_id,content,create_time,update_time) VALUES(#{taskId},#{typeId},#{content},#{createTime},#{updateTime})")
    void insert(MessageEntity messageEntity);

    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "taskId", column = "task_id"),
            @Result(property = "typeId", column = "type_id"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time")
    })
    @Select("SELECT * FROM message_infos WHERE task_id = #{taskId}")
    List<MessageEntity> selectByTaskId(Integer taskId);


}
